package atm.client;

import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.sun.javafx.collections.UnmodifiableObservableMap;

import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by Student on 01.12.2014.
 */
public class VehicalTracker {
    private Map<String, MutablePoint> locationsById = new ConcurrentHashMap<String, MutablePoint>();

    public synchronized Map<String, MutablePoint> getLocations(){
        return Collections.unmodifiableMap(locationsById);
    }

    public synchronized void  setLocation(String id, MutablePoint point){
        locationsById.put(id, new ImmutablePoint(point));
    }

    private class ImmutablePoint extends MutablePoint{
        private MutablePoint point;

        public ImmutablePoint(MutablePoint point) {
            super(point);
            this.point = point;
        }
    }

}
